﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="CampaignPeriodControl.ascx.cs" Inherits="CampaignPeriodControl" %>
<asp:Repeater ID="CampaignPeriodRepeater" runat="server" OnItemDataBound="CampaignPeriodRepeater_ItemDataBound" >
<HeaderTemplate><table class="normal CampaignPeriodCheckBoxList" cellpadding="0" cellspacing="0" ><tr>
<th colspan='<%=Colspan1 %>'><%=StartDate.ToString("M月")%></th>
<th colspan='<%=Colspan2 %>'><%=StartDate.AddMonths(1).ToString("M月")%></th>
</tr>
<tr>
<%=DayHtml %>
</tr>
<tr>
</HeaderTemplate>
<ItemTemplate>
<td><span><asp:TextBox ID="txtTimes" runat="server" Text="" MaxLength="1" CssClass="playTimes"
        CausesValidation="true"></asp:TextBox>
    <asp:RangeValidator ID="RangeValidator1" runat="server" Type="Integer" Display="Dynamic"
        MaximumValue="9" MinimumValue="0" ControlToValidate="txtTimes" SetFocusOnError="true"
        ErrorMessage="*"></asp:RangeValidator>
</span><span id="VersionsSpan" class="select" runat="server"><asp:DropDownList ID="VersonDropDownList"
       DataSource='<%# Eval("Versions") %>' runat="server" ></asp:DropDownList></span></td>
</ItemTemplate>
<FooterTemplate></tr></table></FooterTemplate>
</asp:Repeater>
<script type="text/javascript">
$(document).ready(function() {
    $("input.playTimes").keydown(function(event) {
	            switch(event.keyCode) {
                    case 37: //left
                        $(this).parent().parent().prev().find("input.playTimes").focus();
                        break;
                    case 39: //right
                        $(this).parent().parent().next().find("input.playTimes").focus();
                        break;
                    case 40: //down
                        $(this).parent().next().find("select").focus();
                        break;
                }
	        });
	        $("span.select select").keydown(function(event) {
	            switch(event.keyCode) {
                    case 37: //left
                        $(this).parent().parent().prev().find("select").focus();
                        break;
                    case 39: //right
                        $(this).parent().parent().next().find("select").focus();
                        break;
                    case 38: //down
                        $(this).parent().prev().find("input.playTimes").focus();
                        break;
                }
	        });
});
</script>

